let express=require('express')
let {expressjwt}=require('express-jwt')

let app=express()
app.use(express.static('static'))

app.use(express.json())
app.use(express.urlencoded({extended:false}))

// 验证token
app.use(expressjwt({
    secret:'1234',
    algorithms:['HS256']
}).unless({path:['/user/login','/user/register']}))

let userRouter=require('./router/userRouter')
app.use('/user',userRouter)

let postRouter=require('./router/postRouter')
app.use('/post',postRouter)

app.listen(8080)